package com.leesk.trial.springbootdatastatistics.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @Author: leesk
 * @Description:
 * @Date: Create in 15:00 2020/11/16
 * <p>
 * 反序列：将爬下来的数据（或是从数据库中获取）映射为一个实体类
 */
@Data
@AllArgsConstructor
public class RegionStats implements Comparable<RegionStats> {
    private String province;        //  省份
    private String country;         //  国家

    private String lastUpdateDate;  //  更新时间
    private int confirmed;       //  累计确诊
    private int deaths;          //  累计死亡
    private int recovered;       //  累计治愈

    //private int latestTotalCases;     国家最新累计的新冠肺炎总数
    // private int diffFromPrevDay;      相较于昨天国家的新增数量


    @Override
    public String toString() {
        return "province='" + province + '\'' +
                ", country='" + country + '\'' +
                ", lastUpdateDate='" + lastUpdateDate + '\'' +
                ", confirmed=" + confirmed +
                ", deaths=" + deaths +
                ", recovered=" + recovered;
    }

    @Override
    public int compareTo(RegionStats regionStats) {
        if (this.country.compareTo(regionStats.getCountry()) > 0) {
            return 1;
        } else if (this.country.compareTo(regionStats.getCountry()) < 0) return -1;
        else return 0;
    }
}
